package live.zs.mybatisboot.controller;

import live.zs.mybatisboot.dto.PageInfo;
import live.zs.mybatisboot.entity.TbUser;
import live.zs.mybatisboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author madison
 * @description
 * @date 2021/7/8 23:30
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("list")
    public PageInfo<TbUser> list(@RequestBody(required = false) PageInfo pageInfo) {
        return userService.selectUsers(pageInfo);
    }


    @PutMapping("save")
    public int save(@RequestBody TbUser user) {
        return userService.saveUser(user);
    }
}
